﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="BuscaDoc.aspx.cs" Inherits="CROSLAND.WebApp.BuscaDoc" Title="Untitled Page" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register assembly="IdeaSparx.CoolControls.Web" namespace="IdeaSparx.CoolControls.Web" tagprefix="cc2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHeader" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphMainMenu" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphTopMenu" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cphTopContent" runat="server">
</asp:Content>

<asp:Content ID="Content6" ContentPlaceHolderID="cphMain" runat="server">
    <asp:UpdatePanel ID="upMain" runat="server">
<ContentTemplate>
<div style="height:10px"></div>
<table cellpadding="2" cellspacing="0" style="padding-left:10px; padding-right:100px; width:978px;" class="tbl-detalle" >
<tr>
<td style="width: 150px;">Dato para la búsqueda</td>
<td><asp:TextBox ID="txtDatoBusq" runat="server" Width="230px" CssClass="inputbox" ReadOnly="false" AutoPostBack="false" Font-Size="10" />
    <asp:DropDownList ID="cmbTipoDato" runat="server" Width="120">
    </asp:DropDownList>
    </td>
 </tr>
<tr>
<td>Clase de Documento</td><td>
<asp:DropDownList ID="cmbClaseDocumento" runat="server" Width="200">
    <asp:ListItem Value=""></asp:ListItem>
    <asp:ListItem Value="Z100">Z100 :: Ped Vta Contra Stock</asp:ListItem>
    <asp:ListItem Value="Z105">Z105 :: Pedido Exhibición</asp:ListItem>
    <asp:ListItem Value="Z107">Z107 :: Ped. Campañas</asp:ListItem>
    <asp:ListItem Value="Z108">Z108 :: Ped. Anticipos</asp:ListItem>
    <asp:ListItem Value="Z109">Z109 :: Ped. Consignación</asp:ListItem>
    <asp:ListItem Value="YC02">YC02 :: Cotizacion Vehículos</asp:ListItem>
</asp:DropDownList>
</tr>
<tr>
<td>Material</td><td><asp:TextBox ID="txtMaterial" runat="server" Width="120px" CssClass="inputbox" 
ReadOnly="false" AutoPostBack="false" Font-Size="10" /></td>
</tr>                
<tr>
<td style="width: 150px;"></td>
<td><asp:TextBox Visible="false" ID="txtNomCliente" runat="server" Width="250px" CssClass="inputbox" ReadOnly="false" 
AutoPostBack="false" Font-Size="10" /></td>
</tr>
<tr>
<td>Fecha</td>
<td><asp:TextBox ID="txtFechaInicio" runat="server" Width="70" CssClass="inputbox" ReadOnly="false" AutoPostBack="false" Font-Size="10" /><cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtFechaInicio" Format="dd/MM/yyyy" CssClass="MyCalendar" />a
      <asp:TextBox ID="txtFechaFin" runat="server" Width="70" CssClass="inputbox" ReadOnly="false" AutoPostBack="false" Font-Size="10" />   <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFechaFin" Format="dd/MM/yyyy" CssClass="MyCalendar" />&nbsp;&nbsp;<asp:ImageButton ID="ibtnBuscar" runat="server" ImageAlign="Middle" ImageUrl="~/img/find.png" OnClick="ibtnBuscar_Click" /></td>
</tr>
<tr>
<td>Lote</td><td><asp:TextBox ID="txtLote" runat="server" Width="100px" MaxLength="10" CssClass="inputbox" 
ReadOnly="false" AutoPostBack="false" Font-Size="10" /></td>
</tr>    
</table>
<div style="height:10px"></div>
<cc2:CoolGridView ID="gvPedidos" runat="server" AutoGenerateColumns="false" 
        CssClass="tbl-detalle" Width="978px" OnRowCommand="gvPedidos_RowCommand" 
        GridLines="None" ShowHeader="true" DefaultColumnWidth="897px" Height="350px" 
        AllowPaging="True" onpageindexchanged="Page_Load" 
        onpageindexchanging="gvPedidos_PageIndexChanging" PageSize="12" 
        onrowdatabound="gvPedidos_RowDataBound" >
<Columns>

<asp:ButtonField CommandName="Flujo" ButtonType="Image" ImageUrl="~/img/flujo.png" 
        ShowHeader="true" ItemStyle-HorizontalAlign="Center" 
        ItemStyle-VerticalAlign="Top" ItemStyle-Width="20px" 
    HeaderStyle-Width="20px" >
    <HeaderStyle Width="20px" />
    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="30px" />
    </asp:ButtonField>


    <asp:TemplateField HeaderText="" HeaderStyle-Width="20px"  ItemStyle-HorizontalAlign="Center">
    <ItemTemplate>
          <asp:ImageButton ID="btnRechazo" runat="server" ImageUrl="~/img/cancel.dis.png" CommandName="Rechazo" 
          CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'></asp:ImageButton>

    </ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="" HeaderStyle-Width="20px"  ItemStyle-HorizontalAlign="Center">
    <ItemTemplate>
          <asp:ImageButton runat="server" ImageUrl="~/img/detalle.png" CommandName="Detalle" 
          CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'></asp:ImageButton>

    </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<table border="0" style="background-color:Transparent;">
    <tr>
        <th style="width:85px;">Nro.Pedido</th>
        <th style="width:90px">Cod.Cliente</th>
        <th style="width:310px;">Nombre Cliente</th>
        <th style="width:85px;">NIF</th>
        <th style="width:110px;">Fecha doc.</th>
        <th style="width:110px;">Clase doc.</th>
        <th style="width:110px;">Total</th>        
    </tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table border="0" style="background-color:Transparent; margin-left:3px;">
    <tr style="height:5px;" />
    <tr><td style="width:85px; text-align:center"><asp:Label ID="lblNumPedido" runat="server" Text='<%# Bind("NumPedidoCorto") %>' /></td>
        <td style="width:90px;"><asp:Label ID="Label2" runat="server" Text='<%# Bind("CodClienteCorto") %>' /></td>
        <td style="width:310px;"><asp:Label ID="Label3" runat="server" Text='<%# Bind("DestFactura") %>' /></td>
        <td style="text-align:center; width:85px;"><asp:Label ID="Label4" runat="server" Text='<%# Bind("DestMercaderia") %>' /></td>
        <td style="text-align:center; width:110px;"><asp:Label ID="Label5" runat="server" Text='<%# Bind("FechaString") %>' /></td>
        <td style="width:110px;"><asp:Label ID="Label1" runat="server" Text='<%# Bind("ClaseDocumento") %>' /></td>
        <td style="width:110px;text-align:right"><asp:Label ID="Label7" runat="server" Text='<%# Bind("TotalConIgv", "{0:0,0.00}") %>' /></td>        
    </tr>
    <tr style="height:5px;" />
    <tr>
        <td colspan="7">
            <asp:GridView ID="gvDetalle" runat="server" AutoGenerateColumns="false" CssClass="tbl-detalle"
                        Width="100%" GridLines="Both" BackColor="Transparent" Visible="false" EmptyDataText="hhh" DataSource='<%# Bind("ListaReserva") %>'>
                <Columns>                     
                    <asp:BoundField DataField="posicion" HeaderText="Pos." />
                    <asp:BoundField DataField="codMaterial" HeaderText="Material" />
                    <asp:BoundField DataField="descMaterial" HeaderText="Denominación" />
                    <asp:BoundField DataField="lote" HeaderText="Lote" />
                    <asp:BoundField DataField="motor" HeaderText="Motor" />
                    <asp:BoundField DataField="vin" HeaderText="Vin" />
                    <asp:BoundField DataField="status" HeaderText="Status Venta" />
                    <asp:BoundField DataField="disponibilidad" HeaderText="Disponibilidad" />
                    <asp:BoundField DataField="emplazamiento" HeaderText="Emplazamiento" />
                    <asp:BoundField DataField="marca" HeaderText="Marca" />
                    <asp:BoundField DataField="descColor" HeaderText="Color" />
                    <asp:BoundField DataField="añoFab" HeaderText="Año Fab." />
                    <asp:BoundField DataField="añoFab" HeaderText="Año Fab." />
                    <asp:BoundField DataField="cantidad" HeaderText="Cant." DataFormatString="{0:0,0.00}" ItemStyle-HorizontalAlign="Right" /> 
                    <asp:BoundField DataField="total" HeaderText="Total" DataFormatString="{0:0,0.00}" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="motivoRechazo" HeaderText="Mot. Rechazo" />
                </Columns>
            </asp:GridView>
        </td>
    </tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
    <PagerSettings Mode="NumericFirstLast" />
<AlternatingRowStyle BackColor="Beige" />
    <PagerStyle Font-Size="Medium" />
<HeaderStyle BackColor="Silver" Font-Size="12px" Height="20px" />
    <BoundaryStyle BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" />
</cc2:CoolGridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="cphFooter" runat="server">
</asp:Content>
